import 'dart:async';

import 'package:flutter/services.dart';

class FlutterIflyad {
  static const MethodChannel _channel = const MethodChannel('flutter_iflyad');

  static Future<Null> initSdk(String appId) async {
    assert(appId != null && appId.isNotEmpty);
    Map map = {
      "appId": appId,
    };
    await _channel.invokeMethod('initAdSDK', map);
  }

//  static Future<Null> showSplashAD(
//      {String posId, Function onSplashAdActivityResult}) async {
//    assert(posId != null && posId.isNotEmpty);
//    Map map = {
//      "posId": posId,
//    };
//    await _channel.invokeMethod('showSplashAD', map);
//  }

  static Future<Null> showBannerAD({String adUnitId}) async {
    assert(adUnitId != null);
    Map map = {
      "adUnitId": adUnitId,
    };
    await _channel.invokeMethod('showBannerAD', map);
  }

  static Future<Null> disposeBannerAD({String adUnitId}) async {
    assert(adUnitId != null);
    Map map = {
      "adUnitId": adUnitId,
    };
    await _channel.invokeMethod('disposeBannerAD', map);
  }

  static Future<Null> showInterstitialAd({String adUnitId}) async {
    assert(adUnitId != null);
    Map map = {
      "adUnitId": adUnitId,
    };
    await _channel.invokeMethod('showInterstitialAd', map);
  }

  static Future<Null> showVideoAd({String adUnitId}) async {
    assert(adUnitId != null);
    Map map = {
      "adUnitId": adUnitId,
    };
    await _channel.invokeMethod('showVideoAd', map);
  }
}
